The present invention relates to a computer program translation method, and in particular, to a program translation method in which a given program is translated by use of partial computations so as to obtain an efficient program through specialization.
In a computer program, in general, a kind of data is received to effect processing based thereon so as to attain a desired result. For example, in an example of a program f which receives data values k.sub.0 and u.sub.0 for two parameters k and u for a processing, when achieving an ordinary computation processing (the overall computation), the processing of the program f (k.sub.0, u.sub.0) is accomplished after both input data items k.sub.0 and u.sub.0 are received. In contrast thereto, there has been a computation method known as a partial computation or evaluation of a program in which the computation of the program f is immediately started when one of the data items, for example, k.sub.0 is inputted such that the computation executable based on k.sub.0 is achieved and that a portion which cannot be executed unless the value of u is supplied remains unexecuted, thereby generating a new intermediate program f.sub.k0 (u). For the intermediate program f.sub.k0 (u) thus attained through the partial computation, the computation with respect to k has already been finished in a range where the computation is possible. In consequence, when both values (k.sub.0, u.sub.0) are prepared for k and u, the program execution time can be minimized by executing the program f.sub.k0 (u.sub.0) rather than the program f(k.sub.0, u.sub.0).
Assuming here that the partial computation of the program f with respect to the parameter k=k.sub.0 is represented as .alpha. [f; k.sub.0 ], the intermediate program f.sub.k0 can be expressed as follows. EQU .alpha.[f;k.sub.0 ]=f.sub.k0 ( 1)
Furthermore, in the expression (1), when the program f and the parameter k.sub.0 are replaced with an interpreter of a program language processing and a general program P, respectively, it has been known that the program attained through the partial computation .alpha. [I; P], .alpha. [.alpha.; I], and .alpha. [.alpha.; .alpha.] become to be an object program, a compiler, and a compiler-compiler, respectively. The conventional program translation through these partial computations have been described in detail, for example, in the Partial Computation Method of Program on pages 157 to 165 of the "Journal of the Institute of Electronics and Communication Engineers of Japan", Vol. 86, No. 2 (February, 1983) and in the Partial evaluation of computer process on pages 45 to 50 of the "Computer, Systems, Controls 2", No. 5, 1971.
However, according to the conventional partial computation method, the partial computation is achieved only by use of information items related to parameters for which the values are known; in consequence, the range where the computation is executable, namely, where the program translation is possible through the partial computation is small, which leads to a problem in the practial use of the partial computation method.